#pragma once

#include "Info.hpp"

enum UserIdentity{
  ADMIN = 0,
  STUDENT,
  TEACHER
};

class User : public Info{
public:
  void Serialize(std::string &buf){
    Json::Value val;
    val["identity"] = identity;
    val["id"] = id;
    val["password"] = password;
    Json::FastWriter writer;
    buf = writer.write(val);
  }

  void Deserialize(const std::string &buf){
    Json::Reader reader;
    Json::Value val;
    reader.parse(buf, val, false);
    identity = (UserIdentity)val["identity"].asUInt();
    id = val["id"].asString();
    password = val["password"].asString();
  }


private:
  UserIdentity identity;
  std::string id;
  std::string password;
};
